# 导入包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 获取浏览器驱动
driver = webdriver.Firefox()
# 打开测试的页面
url = 'file:///root/NSD2408/html/registerA.html'
driver.get(url)

# 定位用户名，密码，电话，邮箱
username = driver.find_element(By.CSS_SELECTOR, '#userA')
username.send_keys('admin')
driver.find_element(By.CSS_SELECTOR, '#passwordA').send_keys('1234567')
driver.find_element(By.CSS_SELECTOR, '#telA').send_keys('18812345678')
driver.find_element(By.CSS_SELECTOR, '#emailA').send_keys('123@qq.com')
# 清空用户名，输入新的一个用户名
sleep(3)
# 清空之前的内容
username.clear()
username.send_keys('hello')
# 点击按钮
sleep(3)
driver.find_element(By.CSS_SELECTOR, 'button[type="submitA"]').click()

# 关闭浏览器
sleep(3)
driver.quit()